#include "dtwentycore.h"
#include "skill.h"
#include "characterclass.h"
#include "specialability.h"


#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QDebug>
#include <QQmlContext>
#include <QtQml>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    // register types to qml
    qmlRegisterType<Skill>();
    qmlRegisterType<CharacterClass>();
    qmlRegisterType<SpecialAbility>();

    qmlRegisterType<DTwentyItemsModel>();
    qmlRegisterType<ModelItem>();


    // create dtwenty core
    DTwentyCore core;
    core.createCampaign();


    // create application engine
    QQmlApplicationEngine engine;


    // set dtwenty core available in qml
    QQmlContext* cxt = engine.rootContext();
    cxt->setContextObject(&core);


    // load UI main file
    engine.load("qml/dtwentyui.qml");


    // execute
    return app.exec();
}
